If your video output component saves custom settings with its own implementation of the QTVideoOutputSaveState function, it must also implement a QTVideoOutputRestoreState function to restore the settings. If your video output component has no custom settings, it can use the default QTVideoOutputRestoreState implementation provided by the base video output component. Listing 8 shows an implementation of the QTVideoOutputRestoreState function that restores custom settings from the QT atom container in which they are stored.
Listing 8 Restoring custom settings
pascal ComponentResult MyQTVideoOutputRestoreState (Globals storage,
QTAtomContainer settings)
{
OSErr err;
QTAtom atom;
// call default implementation
err = QTVideoOutputRestoreState (storage->baseVideoOutput, settings);
if (err) goto bail;
// get custom parameter(s)
atom = QTFindChildByID (settings, kParentAtomIsContainer, `FOOB',
1, nil);
if (atom != 0) {
long dataSize;
Ptr dataptr;
QTGetAtomDataPtr (settings, atom, &dataSize, &dataPtr);
storage->customSetting = *(SettingsType *)dataPtr;
}
else {
// reset custom settings to default values
}
bail:
return err;
}
| Previous | Chapter Contents | Chapter Top | Next |